import React from 'react';
import { BrowserRouter as Router, Redirect, Route, Switch } from 'react-router-dom'
import Login from './pages/Login';
import Layout from './pages/Layout';
const App = () => {
    return (
        <Router>
            <div>
                <Switch>
                    {/* 重定向方式一：Redirect组件form属性：必须在Swith中，才能生效 */}
                    {/* <Redirect exact from='/' to='login'></Redirect> */}

                    {/* 重定向方式二： */}
                    <Route exact path='/' render={() => <Redirect to="/login"></Redirect>}></Route>
                    {/* 登录页 */}
                    <Route path='/login' component={Login}></Route>

                    {/* 布局 */}
                    <Route path='/home' component={Layout}></Route>
                </Switch>
            </div>
        </Router>

        
    )
}

export default App